package com.example.administrator.jingpingou.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.MediaController;

import com.example.administrator.jingpingou.bean.Shop_Data;
import com.example.administrator.jingpingou.shop_activity.TitleWebActivity;
import com.jude.rollviewpager.adapter.StaticPagerAdapter;

import java.util.List;

/**
 * Created by 小吧 on 2016/8/30.
 */
public class ShopTitleAdapter extends StaticPagerAdapter {
    private List<ImageView> mData;
    private Context mContext;
    private List<String> mLink;
    public ShopTitleAdapter(List<ImageView> data,Context context,List<String> link){
        mData = data;
        mContext = context;
        mLink = link;
    }

    @Override
    public View getView(ViewGroup container, int position) {
        ImageView imageView = mData.get(position);
        final String linkGo = mLink.get(position);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext,TitleWebActivity.class);
                intent.putExtra("link",linkGo);
                mContext.startActivity(intent);
            }
        });
        return imageView;
    }

    @Override
    public int getCount() {
        return mData==null?0:mData.size();
    }


}
